﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Entity.ModelConfiguration;
using NCP.Recruiting.Domain.Aggregates.Jobpositions;

namespace NCP.Recruiting.Repository.SqlServer.UnitOfWork.Mapping {
    class JobpositionEntityTypeConfiguration : EntityTypeConfiguration<JobPosition> {
        public JobpositionEntityTypeConfiguration() {
            this.HasKey(j => j.Id);
            this.ToTable("ncp_jobposition");
            this.HasRequired(x => x.Department).WithMany().HasForeignKey(x => x.DepartmentId);
            this.HasRequired(j => j.Company)
                .WithMany(c => c.Jobpositions)
                .HasForeignKey(j => j.CompanyId);
        }
    }
}
